package com.tang.kite.benchmark

import com.tang.kite.benchmark.kite.KiteTester
import com.tang.kite.benchmark.mybatis.MyBatisTester
import com.tang.kite.config.KiteConfig
import org.apache.ibatis.logging.LogFactory
import kotlin.system.measureTimeMillis

/**
 * @author Tang
 */
fun main() {
    val dataSource = BaseBenchmark.getDataSource()
    val kiteTester = KiteTester(dataSource)
    val myBatisTester = MyBatisTester(dataSource)
    KiteConfig.enableSqlLogging = false
    LogFactory.useNoLogging()

    kiteTester.select()
    myBatisTester.select()

    val times = 1_000
    val myBatisTime = measureTimeMillis { repeat(times) { myBatisTester.select() } }
    val kiteTime = measureTimeMillis { repeat(times) { kiteTester.select() } }
    println("Kite: $kiteTime ms")
    println("MyBatis: $myBatisTime ms")
}
